#ifndef _RUNNER_HPP_20120609
#define _RUNNER_HPP_20120609

#include <fstream>
#include <iostream>
#include <stdint.h>
#include <string>

#include <getopt.h>
#include "signal.hpp"

class Runner
{
	public :
		Runner();
		~Runner();

		int init(void * pThis, int argc, char * argv[]);
		
		int parse_param();
		
		void usage();

		void start();

	public :
		typedef int (*Init) (void * pThis, int argc, char ** argv);
		typedef int (*Proc) (void * pThis);
		typedef int (*Reload) (void * pThis);
		typedef int (*Finish) (void * pThis);

	public :
		Init          _init;
		Proc          _proc;
		Reload        _reload;
		Finish        _finish;
	public :
		int           _argc;
		char **       _argv;

		std::string   _log4cplus;
		// confsvr ip:port
		std::string   _confsvr_ip;
		uint32_t      _confsvr_port;
		uint32_t      _svr_id;

		std::string   _pid_file;
		std::string   _keyword;

		Signal        _signal;

		void *        _pThis;
	public :
		static struct option _options[];
};

#endif

